package com.mical.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("http://10.162.4.220:8091", "http://10.162.1.134:8091","http://127.0.0.1:8091",
                        "http://10.162.4.220:8092", "http://10.162.1.134:8092","http://127.0.0.1:8092",
                        "http://10.162.4.220:8093", "http://10.162.1.134:8093","http://127.0.0.1:8093",
                        "http://10.162.4.220:8094","http://10.162.1.134:8094", "http://127.0.0.1:8094",
                        "http://10.162.4.220:8095","http://10.162.1.134:8095", "http://127.0.0.1:8095")
                .allowedMethods("*")
                .allowedHeaders("*")
                .exposedHeaders("*")
                .allowCredentials(true).maxAge(3600);
    }
}